package com.fdb.basic.framework.core.threadpool;

/**
 * 多线程返回信息
 * 
 * @author tangxb
 * @since 2015-11-01 10:23:43
 * @version 1.0
 *
 */
public class ExecuteRtnInfo {

	/**
	 * 失败代码
	 */
	private String failCode;

	/**
	 * 失败原因
	 */
	private String failReason;

	/**
	 * 异常
	 */
	private Throwable ex;

	/**
	 * 异常类型
	 */
	private String eType;

	/**
	 * 成功标志
	 */
	private boolean successFlag;

	/**
	 * 返回标志
	 */
	private ExecuteRtn rtn;

	public final static ExecuteRtnInfo instance = new ExecuteRtnInfo();

	public ExecuteRtnInfo() {
		this.successFlag = true;
		this.rtn = ExecuteRtn.SUCCESS;
	}

	public ExecuteRtnInfo(String failCode, String failReason, Throwable ex, String eType, boolean successFlag) {
		super();
		this.failCode = failCode;
		this.failReason = failReason;
		this.ex = ex;
		this.eType = eType;
		this.successFlag = successFlag;
		this.rtn = this.successFlag ? ExecuteRtn.SUCCESS : this.ex == null ? ExecuteRtn.FAILURE : ExecuteRtn.EXCEPTION;
	}

	public static enum ExecuteRtn {

		SUCCESS, FAILURE, EXCEPTION;

	}

	public static boolean isBlank(String str) {
		int strLen;
		if ((str == null) || ((strLen = str.length()) == 0))
			return true;
		strLen = str.length();
		for (int i = 0; i < strLen; i++) {
			if (Character.isWhitespace(str.charAt(i)) == false) {
				return false;
			}
		}
		return true;
	}

	/**
	 * @return the failCode
	 */
	public String getFailCode() {
		return failCode;
	}

	/**
	 * @param failCode
	 *            the failCode to set
	 */
	public void setFailCode(String failCode) {
		this.failCode = failCode;
	}

	/**
	 * @return the failReason
	 */
	public String getFailReason() {
		return failReason;
	}

	/**
	 * @param failReason
	 *            the failReason to set
	 */
	public void setFailReason(String failReason) {
		this.failReason = failReason;
	}

	/**
	 * @return the ex
	 */
	public Throwable getEx() {
		return ex;
	}

	/**
	 * @param ex
	 *            the ex to set
	 */
	public void setEx(Throwable ex) {
		this.ex = ex;
	}

	/**
	 * @return the eType
	 */
	public String geteType() {
		return eType;
	}

	/**
	 * @param eType
	 *            the eType to set
	 */
	public void seteType(String eType) {
		this.eType = eType;
	}

	/**
	 * @return the successFlag
	 */
	public boolean isSuccessFlag() {
		return successFlag;
	}

	/**
	 * @param successFlag
	 *            the successFlag to set
	 */
	public void setSuccessFlag(boolean successFlag) {
		this.successFlag = successFlag;
	}

	/**
	 * @return the rtn
	 */
	public ExecuteRtn getRtn() {
		return rtn;
	}

	/**
	 * @param rtn
	 *            the rtn to set
	 */
	public void setRtn(ExecuteRtn rtn) {
		this.rtn = rtn;
	}

}
